<!doctype html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="css/mui.min.css" rel="stylesheet" />
		<link href="fonts/mui-icons-extra.ttf" rel="stylesheet" />
		<link href="css/style.css" rel="stylesheet" />
		<style>
			.ctn{
				padding-bottom: 0 !important;
				background-color: #1D1D1D;
			}
			.mui-bar-nav {
			    top: 0;
			    -webkit-box-shadow: 0 1px 6px #1D1D1D;
			     box-shadow: 0 1px 6px #1D1D1D; 
			}
		</style>
	</head>
	<body class="optionalPage" style="background-color: #1D1D1D;">
		<!--navBar-->
		<header class="mui-bar mui-bar-nav">
			<h1 class="mui-title">我的</h1>
		</header>
		<div class="mui-content ctn">
			<div class="mui-row user_title">
				<div class="mui-col-sm-4 mui-col-xs-4 user_img">
					<img class="user_img mui-pull-left" src="images/fuhai.png" alt="" />
				</div>
				<div class="mui-col-sm-8 mui-col-xs-8 user_phone">
					<span id="account" class="user_phone mui-pull-left" ></span>
				</div>
			</div>
			<div class="mui-row">
				<ul class="list">
					<li id="openAccount">
						<img src="images/WD_icon_21x21_@3x.png" alt="" />
						<span>证券账户</span>	
						<span class="goCheckIcon mui-icon mui-icon-arrowright mui-pull-right" style="padding-right: 10px;"></span>
						<span class="mui-pull-right rezStatus"></span>
					</li>
					<li id="money">
						<img src="images/bank_card_icon_26x25_@3x.png" alt="" />
						<span>资金明细</span>
						<span class="mui-icon mui-icon-arrowright mui-pull-right"></span>
					</li>
					<li id="deal_search">
						<img src="images/inquire_25x25_@3x.png" alt="" />
						<span>交易查询</span>
						<span class="mui-icon mui-icon-arrowright mui-pull-right"></span>
					</li>
					<li id="set" style="margin-bottom: 0 !important;">
						<img src="images/SZ_icon_26x25_@3x.png" alt="" />
						<span>设置</span>
						<span class="mui-icon mui-icon-arrowright mui-pull-right"></span>
					</li>
					<!--<li id="help">
						<span class="mui-icon mui-icon-reload"></span>
						<span class="">帮助中心</span>
						<span class="mui-icon mui-icon-arrowright mui-pull-right"></span>
					</li>
					<li id="about">
						<span class="mui-icon mui-icon-reload"></span>
						<span class="">关于我们</span>
						<span class="mui-icon mui-icon-arrowright mui-pull-right"></span>
					</li>-->
				</ul>
			</div>
		</div>
		<!--tabBar-->
		<nav class="mui-bar mui-bar-tab">
			<a class="mui-tab-item" href="javacript:void(0)" data-page='market'>
				<img src="images/HQ_icon_21x21_@3x.png" alt="" />
				<span>行情</span>
			</a>
			<a class="mui-tab-item mui-active" href="javacript:void(0)" data-page='optional'>
				<img src="images/ZX_icon_21x21_@3x.png" alt="" />
				<span>自选</span>
			</a>
			<a class="mui-tab-item " data-page='newsPage' href="javacript:void(0)">
				<img src="images/news.png" alt="" />
				<span>资讯</span>
			</a>
			<a class="mui-tab-item " data-page='deal' href="javacript:void(0)">
				<img src="images/JY_icon_21x21_@2x.png" alt="" />
				<span>交易</span>
			</a>
			<a href="javascript:void(0)" class="mui-tab-item" data-page='users'>
				<img src="images/WD_icon_select_21x21_@3x.png" alt="" />
				<span  class="activeBar">我的</span>
			</a>
		</nav>
	</body>
	<script src="js/mui.min.js"></script>
	<script src='libs/easymob-webim-sdk/jquery-1.11.1.js'></script>
	<script src='js/configs.js'></script>
	<script src='js/mstock.js'></script>
	<script type="text/javascript">
		mui.init();
		/*window.addEventListener('refresh',function(){
			plus.webview.getWebviewById('users.html').reload();
		});*/
		//检测到refesh事件则刷新当前页面
		window.addEventListener('refresh',function(){
			plus.webview.getWebviewById('users.html').reload();
		});
		//未检测到refresh事件，意味着当前为浏览器操作 刷新当前页面
		jQuery(function () { 
			var isPageHide = false; 
			window.addEventListener('pageshow', function () { 
			    if (isPageHide) { 
				    window.location.reload(); 
			    } 
			}); 
			window.addEventListener('pagehide', function () { 
			   isPageHide = true; 
			}); 
		})
		mui(".mui-bar").on('tap', '.mui-tab-item ',function() {
			var _page = this.getAttribute("data-page");
			var _url;
			switch(_page) {
				case 'market':
					mui.openWindow({
						url: 'market.html'
					});
					break;
				case 'optional':
					mui.plusReady(function() {
				        var list = plus.webview.getWebviewById('optional.html');
						mui.fire(list,'refresh');
					})
					mui.openWindow({
						url: 'optional.html'
					});
					break;
				case 'newsPage':
					mui.openWindow({
						url: 'news.html'
					});
					break;
				case 'deal':
					if(account&&account!=''){
						mui.openWindow({
							url: 'deal.html'
						});
					}else{
						mui.openWindow({
							url: 'login.html'
						});
					}
					break;
				case 'users':
					if(account&&account!=''){
						mui.openWindow({
							url: 'users.html'
						});
					}else{
						mui.openWindow({
							url: 'login.html'
						});
					}
					break;
			}
		})
		console.log('usersAccount',account);
		if(account){
			document.getElementById("account").innerHTML=account;
			jQuery.ajax({
				type:'post',
				url:server.stockMdetail,
				data:{
					account:account
				},
				dataType:'json',
				success:function(result){
					console.log(JSON.stringify(result));
					var status = result.data.status; // 0：正常 1：待审核 2：未开户 -1：删除 -2拒绝
					if(status==0){
						jQuery('.rezStatus').html('已认证');
						jQuery('.goCheckIcon').hide();
					}else if(status==1){
						jQuery('.rezStatus').html('待认证');
						jQuery('.goCheckIcon').hide();
					}else{
						jQuery('.rezStatus').html('未认证');
						jQuery('.goCheckIcon').show();
						goCheck();
					}
				},
				error:function(result){
					console.log('error',result);
				}
			})
		}else{
			document.getElementById("account").innerHTML="";
			mui.openWindow({
				url:'login.html',
				id:'login.html'
			})
		}
		
		/*mui('.list').on('tap','#openAccount',function(){
			mui.openWindow({
				url:'openAccount.html',
				id:'openAccount.html'
			});
		})*/
		mui('.list').on('tap','#money',function(){
			mui.openWindow({
				url:'money.html',
				id:'money.html'
			});
		})
		mui('.list').on('tap','#set',function(){
			mui.openWindow({
				url:'set.html',
				id:'set.html'
			});
		})
		mui('.list').on('tap','#deal_search',function(){
			mui.openWindow({
				url:'dealSearch.html',
				id:'dealSearch.html'
			});
		})
		function goCheck(){
			mui('.list').on('tap','#openAccount',function(){
				mui.openWindow({
					url:'openAccount.html',
					id:'openAccount.html'
				});
			})
		}
		/*
		document.getElementById("help").addEventListener('tap',function(){
			mui.openWindow({
				url:'reg.html',
				id:'reg.html'
			});
		});
		document.getElementById("about").addEventListener('tap',function(){
			mui.openWindow({
				url:'about.html',
				id:'about.html'
			});
		});*/
	</script>
</html>